package com.ruantu.clothing.dao.finance;

import java.util.List;
import java.util.Map;

import com.ruantu.clothing.entity.YearAndSeason;
import com.ruantu.clothing.entity.finance.FinanceTransaction;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface FinanceTransactionMapper {

	int deleteByPrimaryKey(String id);

	int insert(FinanceTransaction record);

	int insertSelective(FinanceTransaction record);

	FinanceTransaction selectByPrimaryKey(String id);

	int updateByPrimaryKeySelective(FinanceTransaction record);

	int updateByPrimaryKey(FinanceTransaction record);

	List<FinanceTransaction> selectByLSHGSJGPeriodPage(Map<String, Object> params);

	int selectByLSHGSJGPeriodPageCount(Map<String, Object> params);

	/**
	 * 倒序查询订单编号
	 *
	 * @param jgid
	 * @return
	 */
	List<String> selectLdid(String jgid);

	/**
	 * 根据机构jgid查询
	 *
	 * @param jgid
	 * @return
	 */
	List<FinanceTransaction> selectByJgid(String jgid);

	/**
	 * 通过往来单位和类型查询订单编号
	 *
	 * @param jgid
	 * @return
	 */

	List<String> queryByWidAndType(@Param("jgid") String jgid, @Param("wldwid") String wldwid, @Param("wldwType") Integer wldwType);

	/**
	 * 根据往来单位id和收支记录的id查询往来单位的类型
	 *
	 * @param wldwid
	 * @return
	 */
	@Select("SELECT DISTINCT * FROM finance_transaction WHERE id=#{id} AND wldwid=#{wldwid}")
	FinanceTransaction findWldwTypeById(@Param("id") String id, @Param("wldwid") String wldwid);

	@Select("SELECT DISTINCT yearandseason FROM finance_transaction where gsjg=#{jgId} and  yearandseason is not null ")
	  List<YearAndSeason> findNAJ(String jgId);


}